# -*- coding: utf-8 -*-
import time
from selenium import webdriver
import unittest
import xlrd
from venv1.Page.loginPage import loginPage
from venv1.publicModule.login import login
from venv1.Page.policyIfmComPage import policyIfmComPage
from venv1.publicModule.policyIfmCom import policyIfmCom
from venv1.publicModule.UWdeal import UWdeal
from venv1.Page.inqueryPage import inqueryPage
from venv1.publicModule.inquery import inquery
from venv1.publicModule.Recheck import Recheck
class Drop_Case(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        print('开始测试')
        self.driver = webdriver.Chrome()
        self.driver.implicitly_wait(10)
        self.driver.maximize_window()
        self.driver.get("http://10.22.26.74:8080/dist/index.html#/")
        time.sleep(2)
        self.loginPage = loginPage(self.driver)
        self.login = login(self.driver)
        self.policyIfmComPage = policyIfmComPage(self.driver)
        self.policyIfmCom = policyIfmCom(self.driver)
        self.inqueryPage = inqueryPage(self.driver)
        self.inquery = inquery(self.driver)
        self.UWdeal=UWdeal(self.driver)
        self.Recheck=Recheck(self.driver)
    def test01(self):
        filename= r'C:\Users\tanjm.ext\PycharmProjects\OWB\TestData\Data.xls'
        excel_open=xlrd.open_workbook(filename)
        table=excel_open.sheet_by_name('Sheet1')
        rows=table.nrows
        for i in range(2,rows):
            row_content=table.row_values(i)
            username=row_content[0]
            password=row_content[1]
            login.login(self,username,password)
    # def test02(self):
    #     filename = r'C:\Users\tanjm.ext\PycharmProjects\OWB\TestData\Data.xls'
    #     excel_open = xlrd.open_workbook(filename)
    #     table = excel_open.sheet_by_name('Sheet1')
    #     rows = table.nrows
    #     for i in range(2, rows):
    #         row_content = table.row_values(i)
    #         PolicyNo = row_content[4]
    #         ProjectCode=row_content[5]
    #         policyIfmCom.drop(self,PolicyNo,ProjectCode)
    # def test03(self):
    #     filename = r'C:\Users\tanjm.ext\PycharmProjects\OWB\TestData\Data.xls'
    #     excel_open = xlrd.open_workbook(filename)
    #     table = excel_open.sheet_by_name('Sheet1')
    #     rows = table.nrows
    #     for i in range(2, rows):
    #         row_content = table.row_values(i)
    #         PolicyNo = row_content[4]
    #         UWidea=row_content[6]
    #         inquery.Assign_To(self, PolicyNo)
    #         UWdeal.UWdeal(self,PolicyNo,UWidea)
    def test04(self):
        filename = r'C:\Users\tanjm.ext\PycharmProjects\OWB\TestData\Data.xls'
        excel_open = xlrd.open_workbook(filename)
        table = excel_open.sheet_by_name('Sheet1')
        rows = table.nrows
        for i in range(2, rows):
            row_content = table.row_values(i)
            PolicyNo = row_content[4]
            Recheck.Recheck(self, PolicyNo)


